package com.lzx.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.lzx.entity.Category;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.util.List;

/**
 * @Author: lzx
 * @Date: 2021/2/26 10:46
 */
@Data
@Document(indexName = "products")
public class ProductDto {
    @Id
    @Field(type = FieldType.Integer)
    private Integer id;

    @Field(type = FieldType.Text)
    private String name;

    @Field(type = FieldType.Keyword)
    private String caption;

    @Field(type = FieldType.Double)
    private Double price;

    @Field(type = FieldType.Keyword,index = false)
    private String img;

    @Field(type = FieldType.Boolean)
    private Boolean isactive;

    @Field(type = FieldType.Keyword)
    private String brand;

    @Field(type = FieldType.Object)
    @JsonFormat(shape = JsonFormat.Shape.ARRAY)
    private List<Category> categories;
}
